/**
 * @author dpGroup
 */

package org.doubango.ngn.model.iterator;

import java.util.ArrayList;
import java.util.List;

import org.doubango.ngn.model.NgnPhoneNumber;

public class PhoneNumbersIterator implements INgnIterator {
	List<NgnPhoneNumber> mNgnPhoneNumbers;
	private int currentIndex = 0;

	public PhoneNumbersIterator(List<NgnPhoneNumber> pNgnPhoneNumber) {
		if (pNgnPhoneNumber != null) {
			mNgnPhoneNumbers = pNgnPhoneNumber;
		} else {
			mNgnPhoneNumbers = new ArrayList<NgnPhoneNumber>();
		}
	}

	@Override
	public boolean hasNext(){
		if (currentIndex >= mNgnPhoneNumbers.size()) {
			return false;
		} else {
			return true;
		}

	}

	@Override
	public NgnPhoneNumber next(){
		NgnPhoneNumber ngnPhoneNumber = mNgnPhoneNumbers.get(currentIndex);
		currentIndex++;
		return ngnPhoneNumber;
	}

	@Override
	public boolean remove(Object obj){
		return mNgnPhoneNumbers.remove(obj);
	}

	@Override
	public NgnPhoneNumber remove(int ind){
		return mNgnPhoneNumbers.remove(ind);
	}
}
